package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Patient {
    private int patientId;
    private String patientName12;
    private String patientSex;
    private Integer patientAge;
    private Integer patientTel;
    private String patientDz;
    private String patientSfz;
    private Collection<DoctPatient> doctPatientsByPatientId;
    private Collection<Hospitalization> hospitalizationsByPatientId;
    private Collection<Inspect> inspectsByPatientId;
    private Collection<Medical> medicalsByPatientId;
    private Collection<Payment> paymentsByPatientId;
    private Collection<Veg> vegsByPatientId;

    @Id
    @Column(name = "patient_id", nullable = false)
    public int getPatientId() {
        return patientId;
    }

    public void setPatientId(int patientId) {
        this.patientId = patientId;
    }

    @Basic
    @Column(name = "patient_name12", nullable = true, length = 50)
    public String getPatientName12() {
        return patientName12;
    }

    public void setPatientName12(String patientName12) {
        this.patientName12 = patientName12;
    }

    @Basic
    @Column(name = "patient_sex", nullable = true, length = 2)
    public String getPatientSex() {
        return patientSex;
    }

    public void setPatientSex(String patientSex) {
        this.patientSex = patientSex;
    }

    @Basic
    @Column(name = "patient_age", nullable = true, precision = 0)
    public Integer getPatientAge() {
        return patientAge;
    }

    public void setPatientAge(Integer patientAge) {
        this.patientAge = patientAge;
    }

    @Basic
    @Column(name = "patient_tel", nullable = true, precision = 0)
    public Integer getPatientTel() {
        return patientTel;
    }

    public void setPatientTel(Integer patientTel) {
        this.patientTel = patientTel;
    }

    @Basic
    @Column(name = "patient_dz", nullable = true, length = 50)
    public String getPatientDz() {
        return patientDz;
    }

    public void setPatientDz(String patientDz) {
        this.patientDz = patientDz;
    }

    @Basic
    @Column(name = "patient_sfz", nullable = true, length = 18)
    public String getPatientSfz() {
        return patientSfz;
    }

    public void setPatientSfz(String patientSfz) {
        this.patientSfz = patientSfz;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Patient patient = (Patient) o;
        return patientId == patient.patientId &&
                Objects.equals(patientName12, patient.patientName12) &&
                Objects.equals(patientSex, patient.patientSex) &&
                Objects.equals(patientAge, patient.patientAge) &&
                Objects.equals(patientTel, patient.patientTel) &&
                Objects.equals(patientDz, patient.patientDz) &&
                Objects.equals(patientSfz, patient.patientSfz);
    }

    @Override
    public int hashCode() {
        return Objects.hash(patientId, patientName12, patientSex, patientAge, patientTel, patientDz, patientSfz);
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<DoctPatient> getDoctPatientsByPatientId() {
        return doctPatientsByPatientId;
    }

    public void setDoctPatientsByPatientId(Collection<DoctPatient> doctPatientsByPatientId) {
        this.doctPatientsByPatientId = doctPatientsByPatientId;
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<Hospitalization> getHospitalizationsByPatientId() {
        return hospitalizationsByPatientId;
    }

    public void setHospitalizationsByPatientId(Collection<Hospitalization> hospitalizationsByPatientId) {
        this.hospitalizationsByPatientId = hospitalizationsByPatientId;
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<Inspect> getInspectsByPatientId() {
        return inspectsByPatientId;
    }

    public void setInspectsByPatientId(Collection<Inspect> inspectsByPatientId) {
        this.inspectsByPatientId = inspectsByPatientId;
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<Medical> getMedicalsByPatientId() {
        return medicalsByPatientId;
    }

    public void setMedicalsByPatientId(Collection<Medical> medicalsByPatientId) {
        this.medicalsByPatientId = medicalsByPatientId;
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<Payment> getPaymentsByPatientId() {
        return paymentsByPatientId;
    }

    public void setPaymentsByPatientId(Collection<Payment> paymentsByPatientId) {
        this.paymentsByPatientId = paymentsByPatientId;
    }

    @OneToMany(mappedBy = "patientByPatientId")
    public Collection<Veg> getVegsByPatientId() {
        return vegsByPatientId;
    }

    public void setVegsByPatientId(Collection<Veg> vegsByPatientId) {
        this.vegsByPatientId = vegsByPatientId;
    }
}